#ifndef _COMM_JOB_H_
#define _COMM_JOB_H_

#include <time.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct job_manager JM;

typedef struct job job;

JM * jm_create(void * user_data);
void * jm_user_data(JM * jm);
void jm_destory(JM * jm);

job * jm_push(JM * jm, void * data, time_t timeout);
void * jm_pop(JM * jm, time_t * timeout);

job * jm_get(JM * jm);
void  jm_remove(job * j);

void * job_data(job * j, time_t * timeout);

job * jm_get_timeout(time_t now, JM ** jm);

#ifdef __cplusplus
}
#endif

#endif
